<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/include/global.jsp"%>
<%@ page import="net.sxnic.ugr.menu.Menu" %>

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/qui/skins/vistaBlue/menu/menu.css" />
<script type="text/javascript">
<!--

$(function(){
	var spanId = document.getElementById("menu_1");
	$(spanId).addClass("current");
})
function _clMenu(menuCode) {
	var i=1;
	var count = 30;
	for (i=1;i<=count;i++){
		var menu= "_menu_"+i;
		var spanId = document.getElementById(menu);
		if(i==menuCode) {
			$(spanId).addClass("current");
		} else {
			$(spanId).removeClass("current");
		}
	}
}
//-->
</script>
<% %>
<div id="scrollContent">
<ul>
<li><a onclick="javascript:_clMenu('0');" class="top_link current" id="_menu_0" href="${pageContext.request.contextPath}/main.jspa"><span class="down" >首页</span></a></li>
<%
	int count = 1;

	List<Menu> menuList = (List<Menu>)request.getAttribute("menuList");
	Map<String, List<Menu>> secodeMenuMap = (Map<String, List<Menu>>)request.getAttribute("secodeMenuMap");
	Map<String, String> userMenuMap = (Map<String, String>)request.getAttribute("userMenuMap");
	StringBuilder sb = new StringBuilder();
	
	for(Menu menu:menuList){		
		if(userMenuMap.containsKey(menu.getCode())){
			sb.append("<li><a href=\""+request.getContextPath()+menu.getUrl()+".jspa?menuCode="+menu.getCode()+"\"  id=\"_menu_"+count+"\" class=\"top_link\"  onclick=\"javascript:_clMenu('"+count+"');\" target=\"frmright\"><span id=\"menu_${count}\" class=\"down\">"+menu.getValue()+"</span></a>");
			sb.append("<ul class='sub' style='display:block;'>");
			List<Menu> secodeMenuList = secodeMenuMap.get(menu.getCode());
			for(Menu menu2:secodeMenuList){
				if(userMenuMap.containsKey(menu2.getCode())){
					count ++;	
					sb.append("<li><a href=\""+request.getContextPath()+menu2.getUrl()+".jspa?menuCode="+menu2.getCode()+"\" onclick=\"javascript:_clMenu('"+count+"');\" target=\"frmright\">"+menu2.getValue()+"</a></li>");
				}				
			}			
			sb.append("</ul>");
			sb.append("</li>");
		}
		count++;
	}
	out.println(sb.toString());
%>
	<div class="clear"></div>
	
</ul>
</div>